package com.fansl.koala.quickdev.module.koala.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fansl.koala.quickdev.module.koala.entity.UserVip;
import com.fansl.koala.quickdev.module.koala.mapper.UserVipMapper;
import com.fansl.koala.quickdev.module.koala.service.IUserVipService;
import org.springframework.stereotype.Service;

/**
 * @author fansl
 * @Description: TODO
 * @date 2020/5/6 12:39
 */
@Service
@DS("koala_users")
public class UserVipServiceImpl extends ServiceImpl<UserVipMapper, UserVip> implements IUserVipService {
    /**
     * 根据id获取用户vip信息
     *
     * @param userId userId
     * @return vip info
     */
    @Override
    public UserVip getByUserId(Long userId) {
        if (userId <= 0) {
            return null;
        }
        return baseMapper.selectOne(Wrappers.<UserVip>lambdaQuery().eq(UserVip::getUserId, userId));
    }
}
